var GownFullObjectHandler = Base.extend({
	sendstr_id_handler: {},
	sendstr_nodeName_handler: {},
	constructor: function()
	{
	},
	SendString: function(obj,str)
	{
		var handler;

		handler = null;
		// check if there is a id
		if(obj.id && this.sendstr_id_handler[obj.id]) handler = this.sendstr_id_handler[obj.id];
		if(!handler && obj.nodeName) { 
			var nodename = obj.nodeName.toLowerCase();
			handler = this.sendstr_nodeName_handler[nodename];
		}
		if(!handler) {
			Debug.trace(0,'GownFullObjectHandler: no object handler exists for this object.');
			return false; // no handler exist
		}

		return handler(obj,str);
	}
});

var GownFullDefaultObjectHandler = GownFullObjectHandler.extend({
	constructor: function()
	{
	},
	sendstr_nodeName_handler: {
		'input': function(o,s) 
		{
			if(o.type && o.type == 'text') {
				if(o.focus) o.focus();
				if(o.selectionStart != null) {
					var start = o.selectionStart;
					var end = o.selectionEnd;
					var len = o.value.length;
	
					o.value = o.value.substring(0,start) + s + o.value.substring(end,len);
					start = start + s.length;
					end = start;
					if(o.setSelectionRange) o.setSelectionRange(start,end);
					else {
						o.selectionStart = start;
						o.selectionEnd = end;
					}
				}
				else if(document.selection) {
					var sel = document.selection.createRange();
					sel.text = s;
				}
				else o.value += s;
			}
			else return false;
		},
		'textarea': function(o,s) 
		{
			if(o.focus) o.focus();
			if(o.selectionStart != null) {
				var start = o.selectionStart;
				var end = o.selectionEnd;
				var len = o.value.length;

				o.value = o.value.substring(0,start) + s + o.value.substring(end,len);
				start = start + s.length;
				end = start;
				if(o.setSelectionRange) o.setSelectionRange(start,end);
				else {
					o.selectionStart = start;
					o.selectionEnd = end;
				}
			}
			else if(document.selection) {
				var sel = document.selection.createRange();
				sel.text = s;
			}
			else o.value += s;
		}
	}
});
